package com.hex.ds.hdtp.core.app.data.transfer.converter;

import com.hex.ds.hdtp.core.app.data.configuration.dto.excel.DataTransferListExcelDto;
import com.hex.ds.hdtp.core.app.data.transfer.dto.request.DataTransferListRequestDto;
import com.hex.ds.hdtp.core.app.data.transfer.dto.response.DataTransferListResponseDto;
import com.hex.ds.hdtp.core.inf.data.transfer.po.DataTransferListPo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;

import java.util.List;

/**
 * @Package: com.hex.ds.hdtp.core.app.data.transfer.converter
 * @ClassName IDataTransferListConverter
 * @Description: 数据迁移清单-DTO和PO对象转换
 * @Author: wz.li
 * @Date 2023/8/17 19:55
 * @Version v2.0.2
 **/
@Mapper(componentModel = "spring")
public interface IDataTransferListConverter {

    DataTransferListPo toPo(DataTransferListRequestDto dataTransferListRequestDto);

    List<DataTransferListResponseDto> toDtoList(List<DataTransferListPo> dataTransferListPos);

    DataTransferListResponseDto toDto(DataTransferListPo dataTransferListPo);

    @Mapping(target = "sourceConnName", source = "sourceCode")
    @Mapping(target = "targetConnName", source = "targetCode")
    DataTransferListExcelDto toDataTransferListExcelDto(DataTransferListResponseDto dto, String sourceCode, String targetCode);

    @Mapping(target = "sourceConnPkId", source = "sourcePkId")
    @Mapping(target = "targetConnPkId", source = "targetPkId")
    void updateDataTransferListExcelDto(@MappingTarget DataTransferListExcelDto targetDto,
                                        String sourcePkId,
                                        String targetPkId);

}
